<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<%@ page contentType="text/html; charset=utf-8"%>
	<%@ include file="/commons/taglibs.jsp"%>
	
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
		<title>数据交换中心管理</title>

		<%@ include file="/commons/css_js_head.jsp"%>

<!-- 模式窗口 -->
<script type="text/javascript" src="../lhgdialog/lhgcore.min.js"></script>
<script type="text/javascript" src="../lhgdialog/lhgdialog.min.js"></script>

		<script type="text/javascript">
//复写Url
doListUrl = "${ctx }/base/tsMomAction!doList.ts";
doAddBeforeUrl = "${ctx }/base/tsMomAction!doFindById.ts";
doUpdateBeforeUrl = "${ctx }/base/tsMomAction!doFindById.ts";
doDelUrl = "${ctx }/base/tsMomAction!doDelete.ts"
//添加之前
function doAddBefore() {
	var _form = document.forms[0];
	if (doAddBeforeUrl == '') {
		alert('请设置正确的URL!');
		return false;
	}

	_form.action = doAddBeforeUrl;
	_form.submit();
}

//更新之前 
function doUpdateBefore(pkId,type) {
	var _form = document.forms[0];
	if (doUpdateBeforeUrl == '') {
		alert('请设置正确的URL!');
		return false;
	}

	//_form.action = doUpdateBeforeUrl + "?momId=" + pkId +"&type="+type;
	//_form.submit();
	tb_show("update","${ctx }/base/tsMomAction!doFindById.ts?momId="+ pkId+"&keepThis=true&TB_iframe=true&width=800&height=400&modal=true",false);
}

function queryMon(url) {
	if (url == '') {
		alert('请正确配置交换中心地址!');
		return false;
	}
	//tb_show("查看交换中心",url+"?&keepThis=true&TB_iframe=true&width=700&height=400&modal=true",false);
	var showDiag = new J.dialog( {
			id:"two_",
			title : "查看交换中心",
			page : url,
			rang : true,
			iconTitle : false,
			autoSize : true,
			height  :500,
			width  :900,
			cover : false,
			resize : true,
			iconTitle : false,
			minBtn : false,
			maxBtn : false,
			xButton : true,
			btnBar : true,
			link : true
		});
		showDiag.ShowDialog();
}

//删除
function doDel(pkId) {
	var _form = document.forms[0];
	if (doDelUrl == '') {
		alert('请设置正确的URL!');
		return false;
	}
	if(confirm("确定下线?"))
		{
		   _form.action = doDelUrl + "?momId=" + pkId;
	       _form.submit();
		}
	return false;
	
}
function doAdd1(){
  
  tb_show("add","${ctx}/base/tsMomAction!doFindById.ts?keepThis=true&TB_iframe=true&width=1000&height=500&modal=true",false);
  //this.blur();
}


//关闭小窗口
function onCancel()
{
	closeWindow();
}
function closeWindow()
{
	self.parent.tb_remove();
}
</script>

	</head>
	<body style="overflow-x: hidden">

		<!-- 标题 -->
		<div class="mTitle">
			<span class="hidsearch"><a href="javascript:void(0)"
				onClick="return chg('searchList');" id="ImgArrow"> <img
						src="${ctx}/images/icon_up.gif" id="imgButton" />
			</a> </span>
			<b class="bbig">数据交换中心管理</b>
			<a href="javascript:void(0)" onclick="javascript:doAddBefore();" >增加数据交换中心</a>
			<!--  <a href="javascript:void(0)" onclick="javascript:doAdd1();" >增加机器</a>-->
		</div>

		<!--list -->
		<div class="searchBar" id="searchList" style="display: block;">
			<form action="/base/tsMomAction!doList" method="post">
				<table class="searchTable">
					<tr>
						<th>
							数据交换中心名称：
						</th>
						<td>
							<s:textfield name="name" theme="simple"></s:textfield>
						</td>
							<th>
							是否上线
						</th>
						<td>
							 <s:select list="#{1:'是',0:'否'}"  
							theme="simple"
							name="status"
							listKey="key" 
							cssStyle="width:50px;"	
							listValue="value"  
							value="1"
							/> 
						</td>
						
						
						<td>
							<input name="btn_query" type="button" class="btn" value="查询"
								onclick="doQuery();" />
							
						</td>
					</tr>
				</table>
			</form>
		</div>
		<div class="mainList">

			<table class="listTable">
				<tr>
					<th>序号</th>
					<th>
						数据交换中心编号
					</th>
					<th>
						数据交换中心名称
					</th>
					<th>
						IP地址
					</th>
					<th>
						端口
					</th>
					<th>
						DNS域名
					</th>
					
					<th>
						是否上线
					</th>
					<th>
						地址
					</th>
					<th>
						备注
					</th>
					<th>
						操作
					</th>
					
				</tr>

				<c:forEach var="mom" varStatus="status" items="${pager.data}">
					<tr align=center>
						<td>${status.index+1} </td>
						<td>
							${mom.momid}
						</td>
							<td>
							${mom.name}
						</td>
						<td>
							${mom.ipAddress}
						</td>
						<td>
							${mom.port}
						</td>
						<td>
							${mom.dns}
						</td>
						<td>
						 <c:if test="${mom.status == '1'}">  <spand>是</spand> </c:if>
						 <c:if test="${mom.status == '0'}">  <spand>否</spand> </c:if>
						</td>
						<td>
							${mom.address}
						</td>
						<td>
							${mom.remark}
						</td>
						<td>
							<a href="javascript:void(0)"
								onclick="javascript:doUpdateBefore('${mom.momid}' ,'${mom.type}');"><span
								class="icon_edit">&nbsp;</span>修改</a>
							<a href="javascript:void(0)" onclick="javascript:doDel('${mom.momid}');"><span
								class="icon_del">&nbsp;</span>下线</a>
							<a href="javascript:void(0)"
								onclick="javascript:queryMon('http://${mom.ipAddress}:8080/switch-platform/admin/index.jsp');"><span
								class="icon_edit">&nbsp;</span>查看数据</a>
						</td>
					</tr>
				</c:forEach>
			</table>
		</div>
		<!--end list -->

		<!-- 分页区域  -->
<%@ include file="/page/pager.jsp"%>

<script type="text/javascript">
ajaxAnywhere.formName = "form1";
ajaxAnywhere.getZonesToReload = function() {
    return "zoneList";
}
</script>

	</body>
</html>
